package controller

import (
	"context"
	v1 "wh-1-backend/api/v1"
	"wh-1-backend/internal/service"
)

type cCity struct {
}

var City = cCity{}

func (c *cCity) ListByPid(ctx context.Context, req *v1.CityListByPidReq) (res *v1.CityRes, err error) {
	cityList, err := service.City().ListByPid(ctx, req.Pid)
	if err != nil {
		return nil, err
	}
	res = &v1.CityRes{
		List: cityList,
	}
	return
}

func (c *cCity) List(ctx context.Context, req *v1.CityListReq) (res *v1.CityRes, err error) {
	list, err := service.City().List(ctx)
	res = &v1.CityRes{
		List: list,
	}
	return
}
